import { createRouter, createWebHistory } from 'vue-router'
import Home from './views/Home.vue'
import FindWork from './views/FindWork.vue'
import Notes from './views/Notes.vue'
import Rules from './views/Rules.vue'
import Login from './views/Login.vue'
import Register from './views/Register.vue'
import EmailSent from './views/EmailSent.vue'
import RegisterForm from './views/RegisterForm.vue'
import ArticleDetail from './views/ArticleDetail.vue'
import recruitmentDetails from './views/RecruitmentDetails.vue'
import JobDetails from './views/JobDetails.vue'
import component from 'element-plus/es/components/tree-select/src/tree-select-option.mjs'

const routes = [
  {path:'/forget',component:()=>import('./views/forgetword.vue')},
  {path:'/company',component:()=>import('./views/company.vue'), meta: { requiresLayout: 'header-only' }},
  { path: '/test', component:()=>import('./views/test.vue'),meta: { requiresLayout: 'footer-only' }},
  { path: '/', component: Home, meta: { requiresLayout: true } },
  { path: '/find-work', component: FindWork, meta: { requiresLayout: true } },
  { path: '/notes', component: Notes, meta: { requiresLayout: 'header-only' } },
  { path: '/rules', component: Rules, meta: { requiresLayout: 'header-only' } },
  { path: '/article/:id', component: ArticleDetail, meta: { requiresLayout: 'header-only' } },
  { path: '/login', component: Login },
  { path: '/register', component: Register },
  { path: '/email-sent', component: EmailSent },
  { path: '/register-form', component: RegisterForm },
  { path: '/recruitmentDetails', component: recruitmentDetails, meta: {requiresLayout: true  } },
  { path: '/JobDetails', component: JobDetails, meta: { requiresLayout: true } },
  // 用户相关页面路由
  { 
    path: '/user/mypage', 
    component: () => import('./views/user/mypage/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/workorders', 
    component: () => import('./views/user/workorders/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/bankaccount', 
    component: () => import('./views/user/bankaccount/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/payment', 
    component: () => import('./views/user/payment/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/withdrawal', 
    component: () => import('./views/user/withdrawal/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/transactions', 
    component: () => import('./views/user/transactions/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/profile', 
    component: () => import('./views/user/profile/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/avatar', 
    component: () => import('./views/user/avatar/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/password', 
    component: () => import('./views/user/password/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
  { 
    path: '/user/joblist', 
    component: () => import('./views/user/joblist/index.vue'), 
    meta: { requiresLayout: 'header-only', requiresAuth: true } 
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
})

export default router